package com.hrhx.sender.email;

import java.util.List;

import org.apache.log4j.Logger;

import com.hrhx.sender.ConfigEmailBean;
import com.hrhx.sender.MessageSenderInterface;

public class EmailSender implements MessageSenderInterface {
	
	private Logger log = Logger.getLogger(EmailSender.class);
	
	private ConfigEmailBean configEmailBean;
	private String to;
	private String copyto;
	private String subject;
	private String content;
	private List<String> filenameList;
	
	@Override
	public void send() {
		log.info("MessageSenderFactory工厂模式启用：EmailSender的send开始执行！");
		EmailUtil.send(
				getConfigEmailBean().getSmtp(), 
				getConfigEmailBean().getFrom(), 
				getTo()+","+getCopyto(),
				getSubject(), 
				getContent(), 
				getConfigEmailBean().getUsername(), 
				getConfigEmailBean().getPassword(), 
				getFilenameList());
		log.info("MessageSenderFactory工厂模式结束：EmailSender的send结束执行！");
	}
	
	public ConfigEmailBean getConfigEmailBean() {
		return configEmailBean;
	}

	public void setConfigEmailBean(ConfigEmailBean configEmailBean) {
		this.configEmailBean = configEmailBean;
	}

	public String getTo() {
		return to;
	}

	public void setTo(String to) {
		this.to = to;
	}

	public String getCopyto() {
		return copyto;
	}

	public void setCopyto(String copyto) {
		this.copyto = copyto;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public List<String> getFilenameList() {
		return filenameList;
	}

	public void setFilenameList(List<String> filenameList) {
		this.filenameList = filenameList;
	}
	
}
